package msu.ml.tools;

import javax.swing.*;

public class DoubleConverter
{
	public static void main(String [] args)
	{
		String input;
		do
		{
			input = JOptionPane.showInputDialog("Hex Double: ");
			StringBuilder builder = new StringBuilder();
			for(int i = 0; i < input.length(); i++)
				if(input.charAt(i) != ' ')
					builder.append(input.charAt(i));

			long l = Long.parseLong(builder.toString(), 16);
			double d = Double.longBitsToDouble(Long.reverseBytes(l));

			JOptionPane.showMessageDialog(null, "" + d);

		}while(input != null && !input.equals("quit"));

	}
}
